<template>
  <div class="base-setting">
    <div class="base-setting_item">
      <h5>站点名称：</h5>
      <input type="text" v-model="siteInfo.name" />
    </div>
    <div class="base-setting_item">
      <h5>站点描述：</h5>
      <input type="text" v-model="siteInfo.description" />
    </div>
    <div class="base-setting_item">
      <h5>关键词：</h5>
      <input type="text" v-model="siteInfo.keyword" />
    </div>
    <div class="base-setting_item">
      <h5>站点icon：</h5>
      <Upload @success="successHandle" v-model="siteInfo.iconUrl"></Upload>
    </div>
    <Button @click="handleClick">修改</Button>
  </div>
</template>

<script>
import api from '../../../api/site'
export default {
  data() {
    return {}
  },
  methods: {
    async handleClick() {
      const params = this.siteInfo
      try {
        const res = await api.updateSiteInfo(params)
        if (res.code === 200) {
        }
      } catch (err) {
        console.log(err)
      }
    },
    successHandle(url) {
      this.siteInfo.iconUrl = url
    }
  },
  computed: {
    siteInfo() {
      return this.$store.state.site.siteInfo
    }
  }
}
</script>
